#ifndef DATECONTACT_H
#define DATECONTACT_H

#include <QDate>
#include <QString>
#include "contact.h"
#include "listetypeprestation.h"
#include "objtosql.h"


class DateContact : public objToSQL
{
    Q_ENUMS(TypeContact)
public:
    enum TypeContact {PremierContact, Rappel, EnvoiMail, RappelPostMail, Negociation, ConfirmationDate, RappelPourDetail};
    static QStringList ListeTypeContact;

    DateContact();
    DateContact(QDate date, QString commentaire, Contact contact, int indexTypeContact);
    DateContact(QSqlQuery query);

    static const QString NomChampListeTypePrestation;
    static const QString NomChampClientId;
    static const QString NomChampDate;
    static const QString NomChampCommentaire;
    static const QString NomChampTypeContact;
    static const QString NomChampAlarme;
    static const QString NomChampSucces;

    void setClientId(int id);
    void setDate(QDate date);
    void setCommentaire(QString commentaire);
    void setSuccess(bool success);
    void setAlarme(bool alarme);
    void setContact(Contact contact);
    void setTypeContact(int index);
    void setListeTypePrestation(QStringList liste);

    void AddTypePrestation(QString t);
    int getClientId()const;
    TypeContact type() const;
    int getTypeContact()const;
    QStringList getListeTypeContact()const;
    QDate getDate()const;
    QString getCommentaire()const;
    bool getSuccess()const;
    bool getAlarme()const;
    Contact getContact()const;
    void BindValues(QSqlQuery &query, QStringList champs);
    QStringList getListeTypePrestation()const;

    bool operator ==(DateContact const& dateContact);
    bool isNULL()const;

    static QStringList ListeChampSQL();
    static QStringList ListeTypeDataSQL();
    static QString SQLForeignKey();

    QStringList SQLWhere()const;
    QString SQLSet()const;
    QString SetQuery()const;
    QStringList SetBindValues()const;

private:
    int m_clientID;
    QDate m_date;
    QString m_commentaire;
    Contact m_contact;
    int m_TypeContact;
    bool m_alarme;
    bool m_success;
    QStringList m_listTypePrestation;
    void setListeTypeContact();

    int isAlarme()const;
    int isSucces()const;
};

#endif // DATECONTACT_H
